<%@ page language="java" session="true" info=""%> <%@ page import="java.util.*"%> <%@ page import="java.sql.*"%> <%! static { try { Class.forName("org.gjt.mm.mysql.Driver").newInstance(); } catch (Exception e) { //n = n + "Unable to load the driver
" + e.toString() + "

"; System.err.println("Unable to load the driver."); e.printStackTrace(); } } String delete(ServletRequest req) { String msg = "wrong parameters - could not delete!"; String id = req.getParameter("regId"); if (id == null ) return msg; id = id.trim(); if (id.length() < 2) return msg; try { Connection conn = DriverManager.getConnection("jdbc:mysql://oberon.ssw.uni-linz.ac.at/test?user=ssw"); String query = "DELETE FROM registration WHERE regid = " + id ; Statement stat = conn.createStatement(); ResultSet res = stat.executeQuery(query); conn.close(); msg = "Entry with regid " + id + " deleted"; } catch (SQLException e) { System.out.println("SQLException: " + e.getMessage()); System.out.println("SQLState: " + e.getSQLState()); System.out.println("VendorError: " + e.getErrorCode()); msg = "SQLException: " + e.getMessage() + "
SQLState: " + e.getSQLState() + "
VendorError: " + e.getErrorCode() + "

"; } catch (Exception e) { } return msg; } %> Delete

Delete

<% String remoteAdr = request.getRemoteAddr(); if(remoteAdr.equalsIgnoreCase("140.78.145.7") || remoteAdr.equalsIgnoreCase("140.78.145.27") ) { %> <%=delete(request)%>
Back to list <% } else { %>

Access denied

<% } %> <%@ include file="footer.jsp" %>